//---------------------------------------------------------------------------


#pragma hdrstop

#include "string.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

// MilliSecondsBetween

void cStr::Copy(U8* pDest, U8* pSrc, U16 iLen)
{
    while (iLen--)
    {
        *pDest = *pSrc;
        pDest++;
        pSrc++;
    }
}

bool cStr::Compare(U8* pStr1, U8* pStr2, U16 iLen)
{
    for (U16 i = 0; i < iLen; i++)
    {
        if (pStr1[i] != pStr2[i])
        {
            return (false);
        }
    }
    return (true);
}

U16 cStr::GetChecksum(U8* pDataIn, U16 iLen)
{
    U16 temp;
    U16 crc = 0xFFFF;
    U16 i, j;

    for (i=0; i<iLen; i++)
    {
        crc = ((crc^pDataIn[i]) | 0xFF00) & (crc | 0x00FF);
        for (j=0; j<8; j++)
        {
            temp = crc & 0x0001;
            crc >>= 1;
            if (temp)
            {
                crc ^= 0xA001;
            }
        }
    }

    return (crc);
}


